package top.suven.base.http.admin.old.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import top.suven.base.core.mybatis.crud.CommonCrudMapper;
import top.suven.base.http.admin.old.model.SysAdmin;

import java.util.List;

/**
 * @Title: SysAdminService.java
 * @Description: 管理员信息的数据交互类
 * @author lixiangling
 * @date   2018/08/07 14:49:17
 * @version V1.0.0
 * ----------------------------------------------------------------------------
 *  modifyer    modifyTime                 comment
 *
 * ----------------------------------------------------------------------------
 *
 */
public interface SysAdminDao extends CommonCrudMapper<SysAdmin> {
    /**
     * @Title: 删除管理员信息信息
     * @Description:id @{Link Long[]}
     * @param
     * @return
     * @throw
     * @author lixiangling
     * @date 2018/08/07 14:49:17
     *  --------------------------------------------------------
     *  modifyer    modifyTime                 comment
     *
     *  --------------------------------------------------------
     */
    @Update("<script> " +
            "UPDATE sys_admin set status='0'"+
            "WHERE admin_code IN " +
            "<foreach item='item' index='index' collection='idList' open='(' separator=',' close=')'> " +
            "#{item} " +
            "</foreach> " +
            "</script>")
    void del(@Param("idList") List<Long> idList);
    /**
     * @Title: 禁用管理员信息信息
     * @Description:id @{Link Long}
     * @param
     * @return
     * @throw
     * @author lixiangling
     * @date 2018/08/07 14:49:17
     *  --------------------------------------------------------
     *  modifyer    modifyTime                 comment
     *
     *  --------------------------------------------------------
     */
     @Update("<script> " +
             "UPDATE sys_admin  " +
             "SET admin_code = #{enableStatus}  " +
             "WHERE user_id IN " +
             "<foreach item='item' index='index' collection='idList' open='(' separator=',' close=')'> " +
             "#{item} " +
             "</foreach> " +
             "</script>")
     void updateEnableStatus(@Param("enableStatus") String enableStatus, @Param("idList") List<Long> idList);
}